import React from 'react'
import Block from 'fs-flex'
import qs from 'qs'
import CmsService from '../../../../services/CmsService'
import Constant from '../../../../utils/constant';
import Header from '../../../../components/Header/index';


class ContentDetail extends React.Component{
    state={
        data:null
    }
    async componentDidMount(){
        const { id } = qs.parse(this.props.location.search.split('?')[1])
        const {code,data}=await CmsService.detail(id)
        if (Constant.responseOK === code) {
            this.setState({ data: data })
        }
    }
    
    render() {
        const data=this.state.data
        const html=data&& data.articleContent?data.articleContent:'<div>暂无内容</div>'
        return(
            <Block vf>
                <Block>
                    <Header needBack={true} history={this.props.history} title='操作说明详细' />
                </Block>
                <Block a='c' j='c' h={60} fs={20}>
                        {data&& data.articleTitle?data.articleTitle:null}
                </Block>

                <Block v={1} mt={50}>
                    <div dangerouslySetInnerHTML={{__html:html }}/>
                </Block>
            </Block>
        )
    }
    
}
export default ContentDetail;